package com.infore.statisticsAndAlarm.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.infore.statisticsAndAlarm.bo.DatasChartsBo;
import com.infore.statisticsAndAlarm.select.util.PageObject;
import com.infore.statisticsAndAlarm.service.IDataReportsService;
import com.infore.statisticsAndAlarm.util.ResultEntity;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Api(value = "数据报表控制器", tags = { "数据报表控制器" })
@RestController
@RequestMapping("/dataReports")
public class DataReportsController {

	@Autowired
	private IDataReportsService iDataReportsService;

	@ApiOperation(value = "断面时段水质统计接口")
	@GetMapping(value = "/queryDatasStageReports")
	public ResultEntity queryDatasStageReports(DatasChartsBo bo, PageObject pageObject) {
		return iDataReportsService.queryDatasStageReports(bo, pageObject);
	}

	@ApiOperation(value = "水质评价范围统计接口")
	@GetMapping(value = "/waterQualityReports")
	public ResultEntity WaterQualityReports(String startTime, String endTime,
			@RequestParam(value = "projectCode", required = true) String projectCode,
			@RequestParam(value = "provinceId", required = false) String provinceId,
			@RequestParam(value = "basinnId", required = false) String basinnId,
			@RequestParam(value = "stationClassifyId", required = false) String stationClassifyId,
			@RequestParam(value = "stationTypeId", required = false) String stationTypeId,
			@RequestParam(value = "operCompanyId", required = false) String operCompanyId,
			@RequestParam(value = "stationName", required = false) String stationName,
			@RequestParam(value = "userId", required = false) String userId,PageObject pageObject,HttpServletRequest request) {
		return iDataReportsService.WaterQualityReports(startTime, endTime, projectCode, provinceId, basinnId,
				stationClassifyId, stationTypeId, operCompanyId, stationName,userId, pageObject,request);
	}

	@ApiOperation(value = "自动站单站报表")
	@ApiImplicitParams({
			@ApiImplicitParam(value = "时间类型", name = "timeType", paramType = "query", required = true, dataType = "String"),
			@ApiImplicitParam(value = "时间", name = "time", paramType = "query", required = false, dataType = "String"),
			@ApiImplicitParam(value = "站点mn", name = "stationMn", paramType = "query", required = true, dataType = "String") ,
			@ApiImplicitParam(value = "周开始日期", name = "weekSatrt", paramType = "query", required = false, dataType = "String"),
			@ApiImplicitParam(value = "周结束日期", name = "weekEnd", paramType = "query", required = false, dataType = "String")})
	@GetMapping(value = "/audioSingleReports")
	public ResultEntity audioSingleReports(String timeType, String time, String stationMn, String weekSatrt, String weekEnd) {
		return iDataReportsService.audioSingleReports(timeType, time, stationMn, weekSatrt,  weekEnd);
	}

	@ApiOperation(value = "自动站多站报表")
	@ApiImplicitParams({
			@ApiImplicitParam(value = "时间类型", name = "timeType", paramType = "query", required = true, dataType = "String"),
			@ApiImplicitParam(value = "时间", name = "time", paramType = "query", required = false, dataType = "String"),
			@ApiImplicitParam(value = "站点mn", name = "stationMn", paramType = "query", required = true, dataType = "String"),
			@ApiImplicitParam(value = "周开始日期", name = "weekSatrt", paramType = "query", required = false, dataType = "String"),
			@ApiImplicitParam(value = "周结束日期", name = "weekEnd", paramType = "query", required = false, dataType = "String")})
	@GetMapping(value = "/audioMoreReports")
	public ResultEntity audioMoreReports(String timeType, String time, String stationMn, String weekSatrt, String weekEnd) {
		return iDataReportsService.audioMoreReports(timeType, time, stationMn,weekSatrt, weekEnd);
	}

	@ApiOperation(value = "地表水质公报")
	@ApiImplicitParams({
			@ApiImplicitParam(value = "时间类型", name = "timeType", paramType = "query", required = true, dataType = "String"),
			@ApiImplicitParam(value = "时间", name = "time", paramType = "query", required = true, dataType = "String"),
			@ApiImplicitParam(value = "查询参数", name = "queryCode", paramType = "query", required = true, dataType = "String"),
			@ApiImplicitParam(value = "查询类型：area区域basinn流域station单站", name = "queryType", paramType = "query", required = true, dataType = "String"),
			@ApiImplicitParam(value = "用户id", name = "userId", paramType = "query", required = true, dataType = "String")})
	@GetMapping(value = "/publicWaterQualityReports")
	public ResultEntity publicWaterQualityReports(String timeType, String time, String queryCode,
			String queryType,String userId,HttpServletRequest request) {
		timeType = "month";
		return iDataReportsService.publicWaterQualityReports(timeType, time, queryCode, queryType,userId,request);
	}
	
	@ApiOperation(value = "自动站单站报表---图形展示")
	@ApiImplicitParams({
			@ApiImplicitParam(value = "时间类型", name = "timeType", paramType = "query", required = true, dataType = "String"),
			@ApiImplicitParam(value = "时间", name = "time", paramType = "query", required = false, dataType = "String"),
			@ApiImplicitParam(value = "站点mn", name = "stationMn", paramType = "query", required = true, dataType = "String") ,
			@ApiImplicitParam(value = "周开始日期", name = "weekSatrt", paramType = "query", required = false, dataType = "String"),
			@ApiImplicitParam(value = "周结束日期", name = "weekEnd", paramType = "query", required = false, dataType = "String")})
	@GetMapping(value = "/audioSingleReportsCharts")
	public ResultEntity audioSingleReportsCharts(String timeType, String time, String stationMn, String weekSatrt, String weekEnd) {
		return iDataReportsService.audioSingleReportsCharts(timeType, time, stationMn, weekSatrt,  weekEnd);
	}
	
	@ApiOperation(value = "自动站多站报表---图形展示")
	@ApiImplicitParams({
			@ApiImplicitParam(value = "时间类型", name = "timeType", paramType = "query", required = true, dataType = "String"),
			@ApiImplicitParam(value = "时间", name = "time", paramType = "query", required = false, dataType = "String"),
			@ApiImplicitParam(value = "站点mn", name = "stationMn", paramType = "query", required = true, dataType = "String") ,
			@ApiImplicitParam(value = "周开始日期", name = "weekSatrt", paramType = "query", required = false, dataType = "String"),
			@ApiImplicitParam(value = "周结束日期", name = "weekEnd", paramType = "query", required = false, dataType = "String")})
	@GetMapping(value = "/audioMoreReportsCharts")
	public ResultEntity audioMoreReportsCharts(String timeType, String time, String stationMn, String weekSatrt, String weekEnd) {
		return iDataReportsService.audioMoreReportsCharts(timeType, time, stationMn, weekSatrt,  weekEnd);
	}
}
